function cxAlert(content){
    layer.alert(content, {
        icon: 0,
        skin: 'layer-ext-moon'
    })
}

function cxLoad(msg){
    var myMsg = layer.msg(msg, {icon: 16,time:0});
    return myMsg;
}


function cxRefreshTab(tabId){
    top.refreshTabById(tabId)
}

function cxAlertOk(msg){
     //var myMsg = layer.msg(msg, {icon: 1,time:0});
     //return myMsg;
    layer.alert(msg, {
        icon: 1,
        skin: 'layui-layer-ico1'
    })
}

function cxAlertts(msg){
    var myMsg = layer.msg(msg, {icon: 0,time:500});
    return myMsg;
}

function roleId2RoleName(roleId) {
    if(roleId == 1){
        return "管理员";
    }else if(roleId == 2){
        return "审核员";
    }else if(roleId == 3){
        return "录入人员";
    }else if(roleId == 4){
        return "普通人员";
    }else if (roleId == 5){
        return "录入审核人员"
    }
}

function changeDateFormat(dateLongTime) {
    if(dateLongTime == null){
        return null;
    }
    var date = new Date(dateLongTime);
    var YY = date.getFullYear() + '-';
    var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
    return YY + MM + DD;
}

function timestampToTime(timestamp) {
    if(timestamp == null){
        return null;
    }
    var date = new Date(timestamp);
    var YY = date.getFullYear() + '-';
    var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
    var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
    var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
    var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
    return YY + MM + DD +" "+hh + mm + ss;
}
